Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpret value of kill_delay as milliseconds #462

Merged
merged 2 commits into from
Dec 27, 2023

Conversation

lseppala
Copy link
Contributor

@lseppala lseppala commented Aug 30, 2023

kill_delay is parsed as a Duration (ref). When given as an integer (as in the example config), it is interpreted as nanoseconds, not milliseconds. The sleep will be too short to allow a program to respond to the interrupt and stop cleanly. This change allows the number to be interpreted as milliseconds.

This change is made to preserve backwards compatibility. If the value is specified as an value under 1 millisecond/1 000 000 nanoseconds, like 500 in the example config, the value will be interpreted as the number of milliseconds. For users who figured out that you may specify the time as a duration string like ”2s” or use large nanosecond integers like 2000000000 for 2 seconds, the behavior will remain the same.

An alternative is changing kill_delay to be parsed as an integer, like delay and rerun_delay. This will break users who used duration strings or large numbers.

This may be the root cause of the problem reported in #216, as a sufficient value for kill_delay to allow a program to stop gracefully solved this problem for me.

@satetsu888
Copy link

related link #397

But I think this solution is better, with nice backward compatibility considerations.

@xiantang
Copy link
Collaborator

I think the code is great but could u add more test cases for it, once the code is covered i will merge it

@lseppala
Copy link
Contributor Author

@xiantang Tests cases added. Let me know if you want something different.

Copy link

codecov bot commented Dec 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (af962ce) 70.24% compared to head (c28d9a8) 69.31%.
Report is 34 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #462      +/-   ##
==========================================
- Coverage   70.24%   69.31%   -0.93%     
==========================================
  Files           9        8       -1     
  Lines        1035     1046      +11     
==========================================
- Hits          727      725       -2     
- Misses        235      245      +10     
- Partials       73       76       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xiantang xiantang merged commit 56d3d58 into air-verse:master Dec 27, 2023
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants